<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('下级已办毕M')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="post-form">
                <div class="select-list">
                    <ul>
                        <li>
                            工单编号：<input type="text" name="myMwfNO"/>
                        </li>
                        <li>
                            承办部门：<input type="text" name="sbdeptName"/>
                        </li>

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm " id="toolbar" role="group">
            <!--                TODO-->
<!--            <a class="btn btn-success multiple disabled" onclick="OnQxListEditWin('check')">-->
<!--                <i class="fa fa-info"></i> 查看-->
<!--            </a>-->
            <a class="btn btn-success multiple disabled" onclick="sendBackManage()">
                <i class="fa fa-edit"></i> 派单管理
            </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:src="@{/common/js/common.js}"></script>
<script th:inline="javascript">
    var prefix = ctx + "system/mMailWF";
    var mInterior = ctx + "system/mInterior";
    $(function () {
        var options = {
            url: prefix + "/rCity/listSonOverUntreatedJson",
            sortName: "pkId",
            sortOrder: "desc",
            uniqueId: "myPkVal",
            updateUrl: prefix + "/cmnFile/sendBackChk/{id}",
            modalName: "下级已办毕工单",
            fixedColumns: true,
            fixedNumber: 2,
            fixedRightNumber: 1,
            columns: [{
                checkbox: true
            },
                {field:'myPkVal',title:'pkid',visible:false},
                {field:'WfId',title:'WfId',visible:false},
                {field:'MailPK',title:'MailPK',visible:false},
                {field:'fDNo',title:'fDNo',visible:false},
                {field:'pid',title:'pid',visible:false},
                {field:'myMwfNO',title:'工单编号',align:'center',formatter:function(value,row,index){return fmtScanByNO(value,row,index);}},
                {field:'SpareString',title:'信件来源',align:'center',sortable:true},
                {field:'myMwfTopic',title:'工单主题',align:'center',
                    formatter:function (value, row, index,field) {
                        return "<span style='cursor: pointer;' title='"+value+"'>"+value+"</span>"
                    },
                    cellStyle: cellEllipsis
                },
                {field: 'FmContent', title: '工单内容', align: 'center',formatter:function (value, row, index,field) {
                        return "<span style='cursor: pointer;' title='"+value+"'>"+value+"</span>"
                    },
                    cellStyle: cellEllipsis},
                {field:'SBDeptName',title:'承办部门',align:'center',sortable:true},
                {field:'SeqName',title:'交办次序',align:'center',sortable:true},
                {field:'SortName',title:'性质',align:'center',sortable:true,visible:false},
                {field:'bkLimit',title:'办理期限',align:'center'},
                {field:'SendState',title:'签收情况',align:'center',sortable:true,formatter:function(value,row,index){return fmtSBSendState(value,row,index);}},
                {field:'chgBack',title:'回复情况',align:'center',formatter:function(value,row,index){return fmtSBBackState(value,row,index);}},
                {field:'BackState',title:'审查情况',align:'center',sortable:true,formatter:function(value,row,index){return fmtSBBackCheck(value,row,index);}},
                {field:'FlagString',title:'转办情况',align:'center',sortable:true},
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="examine(\'' + row.myPkVal + '\')"><i class="fa"></i>审查</a> ');
                        actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="OnQxListShowWin(\'' + row.WfId + '\')"><i class="fa"></i>详情</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });


    //派单管理
    function sendBackManage(){
        let row = $("#bootstrap-table").bootstrapTable('getSelections');
        let pid=row[0].pid==null?0:row[0].pid;
        var url = prefix + "/cmnFile/sendBackList/" + row[0].WfId+'?pid='+pid;
        var width = '80%';
        var height = '80%';
        var title = '派单管理';
        $.modal.openDialog(title,url,width,height);
    }

    function fmtScanByNO(value,row,index){
        return '<a href="javascript:void(0);" onclick="OnQxListShowWin('+row.WfId+')" title="单击查看详情" class="lstWd">'+value+'</a>';
    }

    function OnQxListShowWin(idWF) {
        var url = 'system/lookup/mailOrderDetail/' + idWF;
        parent.$.modal.openTab('信件工单-详情',url);
    }

    function examine(id){
        var url = 'system/mMailWF/cmnFile/sendBackChk/' + id;
        parent.$.modal.openTab('办理结果审核',url);
    }
</script>
</body>
</html>